<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    <title></title>
    <style>
    p {
        color: red;
    }
    </style>
    <script src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script>
</head>

<body>
    <h2>fadeTo</h2>
    <p>测试文字透明度效果</p>
    <p>慕课网,专注分享</p>
    透明度的设置效果：
    <select id="animation">
        <option value="1">fadeTo( "slow" ,0.5 )</option>
        <option value="2">fadeTo( 1000 ,0.2 )</option>
        <option value="3">fadeTo( 1000 ,0.9 ,complete)</option>
    </select>
    <input id="btnFadeSwitch" type="button" value="点击切换显示/隐藏">
    <script type="text/javascript">
    //【切换显示/隐藏】按钮
    $("#btnFadeSwitch").click(function() {
        var v = $("#animation").val();
        if (v == "1") {
            $("p").fadeTo("slow", 0.5);
        } else if (v == "2") {
            $("p").fadeTo(1000, 0.2);
        } else if (v == "3") {
            $("p").fadeTo(1000, 0.9, function() {
                alert('完成')
            });
        }
    });
    </script>
</body>

</html>
